1. Field of the Invention
This invention relates generally to the field of computer processors. More particularly, the invention relates to an apparatus and method supporting universal logical operations on a computer processor.
2. Description of the Related Art
Computer processors execute instructions to perform mathematical operations and logical operations. Mathematical operations include, for example, floating point and integer addition, subtraction, multiplication, and division, with different levels of precision. Logical operations include functions such as AND, OR, NAND, NOR, XOR, shift left/right, swizzle, selection, and voting, to name just a few.
In certain circumstances (particularly when three or more operands are involved), relatively simply logical operations may require the execution of a significant number of instructions. By way of example, logic such as dest=(src1 AND dest) OR (src2 AND (NOT dest)) is required to specify that if a particular bit in the destination register (dest) is set, source register 1 (src1) should be selected, otherwise source register 2 (src2) should be selected. Executing this operation using conventional techniques requires executing multiple different instructions (two AND operations, one OR operation and one NOT operation). A variety of other relatively simple functions must be implemented with multiple sequences of instructions using conventional techniques.
Accordingly, new techniques for executing logical operations which require the execution of fewer instructions would be beneficial.